package com.tinygray;

import java.io.UnsupportedEncodingException;

/**
 * @Author: tinygray
 * @Description: 公众号:Madison龙少，关注我你会越来越优秀。
 * @className: cacl
 * @create: 2021-04-14 19:06
 */
public class cacl {

    public static void main(String[] args){
        int calc = calc("123", "654");
        int calc1 = calc1("123", "654");
        System.out.println(calc);
        System.out.println(calc1);
    }

    public static int calc(String a, String b) {
        char[] chars1 = a.toCharArray();
        char[] chars2 = b.toCharArray();
        StringBuffer sb = new StringBuffer();
        StringBuffer sb1 = new StringBuffer();
        for (char aChar : chars1) {
            sb.append(aChar);
        }
        for (char aChar : chars2) {
            sb1.append(aChar);
        }
        int i = Integer.parseInt(String.valueOf(sb));
        int i1 = Integer.parseInt(String.valueOf(sb1));
        return i + i1;
    }
    public static int calc1(String a, String b) {
        String s = new StringBuffer(a).reverse().toString();
        String s1 = new StringBuffer(b).reverse().toString();
        int i = Integer.parseInt(s);
        int i1 = Integer.parseInt(s1);
        return i + i1;
    }
}
